import {doGet, appJsonPost, formPost} from '../utils/requestUtil'

/**
 * 登录
 * @param data 
 */
export function loginApi(data:object) {
  return formPost({
    url:'/user/login',
    data
  })
}

/**
 * 注销
 * @param data 
 */
export function logoutApi() {
  return doGet({
    url:'/user/logout'
  })
}

/**
 * 修改密码
 */
export function modifyPwdApi(data:object) {
  return appJsonPost({
      url: "/user/updatePwd",
      data: data
  })
}

/**
 * 添加用户
 */
export function addApi(data:object) {
  return appJsonPost({
      url: "/user/add",
      data: data
  })
}

/**
 * 查询用户表格
 */
export function loadTableApi(searchData:object) {
  return appJsonPost({
      url: "/user/queryPage",
      data: searchData
  })
}

/**
 * 
 * @param id 通过id删除用户
 * @returns 
 */
export function deleteByIdApi(id:string) {
  return doGet({
      url: "/user/deleteById",
      params: {id}
  })
}

/**
 * 通过id进行查询
 */
export function queryByIdApi(id:string) {
  return doGet({
      url: "/user/queryById",
      params: {id}
  })
}
/**
 * 通过id进行修改
 */
export function modifyByIdApi(data:object) {
  return appJsonPost({
      url: "/user/modifyById",
      data: data
  })
}

/**
 * 给用户分配角色
 */
export function assignRoleApi(data:object) {
  return appJsonPost({
      url: "/user/assignRole",
      data
  })
}